pub fn convert_base(num_str: &str, to_base: u32) -> String {
    // num_str = '9(10)', to_base = 8
    let num_end = num_str.find('(').unwrap();
    let num = &num_str[..num_end];
    let from_base = *&num_str[num_end + 1..num_str.len() - 1].parse::<u32>().unwrap(); // from_base = 10
    // from_base = 10, to_base = 8
    // convert to 10 base
    let mut num = num.chars().fold(0, |acc, x| acc * from_base + x.to_digit(from_base).unwrap());
    let mut res = String::new();
    while num > 0 {
        let c = num % to_base;
        if c < 10 {
            res.push((c + '0' as u32) as u8 as char);
        } else {
            res.push((c - 10 + 'a' as u32) as u8 as char);
        }
        num /= to_base;
    }
    res.chars().rev().collect()
}
